package sumZero;

public class Solution {
    public int[] sumZero(int n) {
        int[] arr=new int[n];
        if(n%2==0) {
            for (int i = 0; i < n/2; i++) {
                arr[i]=i;
                arr[n-1-i]=-i;
            }
        }else{
            for (int i = 0; i < (n-1)/2; i++) {
                arr[i]=i;
                arr[n-2-i]=-i;
            }
            arr[n-1]=0;
        }
        return arr;
    }//如果n是偶数 那么就不加0
    //如果n是奇数，就加0
}
